package com.sllx.core.action;

import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.struts2.ServletActionContext;
import com.opensymphony.xwork2.ActionSupport;
public class BaseAction extends ActionSupport{
	
	private static final long serialVersionUID = 5128637195021237484L;
	protected HttpServletRequest request;
	protected HttpSession session;
	protected ServletContext application;
	protected HttpServletResponse response;
	protected PrintWriter out;
	
	protected BaseAction (){
		init();
		//config();
	}
	
	private void init(){
		try {
			this.request = ServletActionContext.getRequest(); 
			this.session = request.getSession();
			this.response = ServletActionContext.getResponse();
			this.application =  ServletActionContext.getServletContext();
				this.out = response.getWriter();
			} catch (IOException e) {
				e.printStackTrace();
			}
	}
	
	private void config(){
		try {
			request.setCharacterEncoding("UTF-8");
			response.setCharacterEncoding("UTF-8");
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
	}


	





	
	
}
